//
//  MemberViewController.m
//  必争医疗
//
//  Created by 毕成 on 14-11-20.
//  Copyright (c) 2014年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "MemberViewController.h"
#import "RegistrateViewController.h"
@interface MemberViewController ()

@end

@implementation MemberViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.view setBackgroundColor:[UIColor grayColor]];
    self.navigationController.navigationBar.translucent = NO;
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"left.png"] style:UIBarButtonItemStyleDone target:self action:@selector(leftAction:)];
    [self.navigationItem setTitle:@"升级会员"];
    [self.tabBarController.tabBar setHidden:YES];
    
    [self creatView];
}

- (void)leftAction:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)creatView
{
    UIView *memberView = [[[UIView alloc] initWithFrame:CGRectMake(10, 10, 355, 180)] autorelease];
    [memberView setBackgroundColor:[UIColor whiteColor]];
    [self.view addSubview:memberView];
    
    UIImageView *memberImage = [[[UIImageView alloc] initWithFrame:CGRectMake(40, 40, 40, 40)] autorelease];
    [memberImage setImage:[UIImage imageNamed:@"会员.png"]];
    [memberView addSubview:memberImage];
    
    UILabel *memberLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0, memberImage.frame.origin.y + memberImage.frame.size.height + 10, 120, 40)] autorelease];
    [memberLabel setText:@"会员期间专享"];
    memberLabel.textAlignment = NSTextAlignmentCenter;
    memberLabel.font = [UIFont fontWithName:nil size:12];
    [memberView addSubview:memberLabel];
    
    UILabel *thread = [[[UILabel alloc] initWithFrame:CGRectMake(memberLabel.frame.origin.x + memberLabel.frame.size.width, memberImage.frame.origin.y, 0.5, 90)] autorelease];
    [thread setBackgroundColor:[UIColor lightGrayColor]];
    [memberView addSubview:thread];
    
    UILabel *messageLabel = [[[UILabel alloc] initWithFrame:CGRectMake(memberLabel.frame.size.width + thread.frame.size.width + 5, memberImage.frame.origin.y, 355 - memberLabel.frame.size.width - thread.frame.size.width, thread.frame.size.height)] autorelease];
    messageLabel.numberOfLines = 0;
    [messageLabel setText:@"不限次提问\n购买医生服务最多可减5元\n30分钟内极速解答"];
    [memberView addSubview:messageLabel];
    
    UIButton *registrate = [[[UIButton alloc] initWithFrame:CGRectMake(memberView.frame.origin.x, memberView.frame.origin.y + memberView.frame.size.height + 20, memberView .frame.size.width, 45)] autorelease];
    [registrate setBackgroundColor:[UIColor greenColor]];
    [registrate setTitle:@"开通会员享受特权" forState:UIControlStateNormal];
    [registrate addTarget:self action:@selector(registrateAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:registrate];
}

- (void)registrateAction:(id)sender
{
    RegistrateViewController *reg = [[RegistrateViewController alloc] init];
    [self.navigationController pushViewController:reg animated:YES];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
